// labN.cpp : Defines the entry point for the console application.
//

#include "stdafx.h"
#include <stdio.h>
#include <fstream>
#include <iostream>

using namespace std;

class YoFile{
    
    FILE * pFile;
    

public:
    
    YoFile(const string & filePath){
	pFile = fopen (filePath.data(),"w");
	
	if(pFile == NULL)
	    throw exception("Can`t open file!");

    }

    ~YoFile(){
	fclose (pFile);
    }

    YoFile& operator<<(const string& str){
	fputs (str.data(), pFile);
	return *this;
    }

    YoFile& operator<<(int i){
	return this->operator<<(convertInt(i));	
    }

    string convertInt(int number){
    if (number == 0)
        return "0";
    string temp="";
    string returnvalue="";
    while (number>0)
    {
        temp+=number%10+48;
        number/=10;
    }
    for (int i=0;i<temp.length();i++)
        returnvalue+=temp[temp.length()-i-1];
    return returnvalue;
}

};


int main(int argc){
    
    YoFile yo("a");

    yo << 1 << 2 << "yooo!";



    int iiii;
    cin >> iiii;
    return 0;
}

